using System.Data;
using Migrator.Framework;

namespace Bxo.Database {
    [Migration(200808200035)]
    public class M200808200035_CreateCategoriesTable : Migration {
        public override void Up() {
            this.Database.AddTable(
                    "Categories",
                    new Column("Id", DbType.Int32, ColumnProperty.Identity),
                    new Column("Project", DbType.Int32, ColumnProperty.NotNull),
                    new Column("Name", DbType.String, 50, ColumnProperty.NotNull)
                    );
            this.Database.AddPrimaryKey("PK_Categories", "Categories", "Id");
            this.Database.AddForeignKey("FK_Categories_Projects", "Categories", "Project", "Projects", "Id");
        }

        public override void Down() {
            this.Database.RemoveForeignKey("Categories", "FK_Categories_Projects");
            this.Database.RemoveTable("Categories");
        }
    }
}